<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>测试</title>
</head>
<body style="padding-left: 50px">
  <h1>macro、nested、return:实战demo</h1>
  <h2>1.macro</h2>
  <div>
      <ul>
          <li>1.无参数的macro</li>
          <div>
              <#macro test>
                  <font color="red">我是无参数的macro</font>
              </#macro>
              <@test />
          </div>

          <li>2.有参数的macro</li>
          <div>
              <#macro test param1 param2>
                  <font color="red">我是有参数的macro, param1=${param1}, param2=${param2}</font>
              </#macro>
              <@test param1="java" param2="python"/>
          </div>
      </ul>
  </div>

  <h2>nested</h2>
  <div>
      <ul>
          <#macro test param1="java">
              ${param1}<br/>
              <#nested param1, "我的nested参数"><br>
          </#macro>

          <li>调用</li>
          <div>
              <@test param1="java";loopVar1, loopVar2>
                  <font color="red">hello ${loopVar1}, ${loopVar2}<br></font>
              </@test>
              <@test param1="python"; loopVar1>
                  hello ${loopVar1}<br>
              </@test>
          </div>
      </ul>
  </div>

  <h3>函数</h3>
  <div>
      <ul>
          <#function doAdd param1 param2>
              <#return param1+param2>
          </#function>
          <li>调用</li>
          <div>
              你好，我是调用${doAdd(100,100)}
          </div>
      </ul>
  </div>
</body>
</html>